tools: libxl: do not leak diskpath during local disk attach
authorIan Campbell <ian.campbell@citrix.com>
Thu, 6 Nov 2014 13:00:31 +0000 (13:00 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 6 Nov 2014 16:30:47 +0000 (16:30 +0000)
commit379b351889a8f02abe30a06e2ce9ba8b381b91ab
tree5484c34f2ab563605431dadf98149a84f51c32e6
parent816f5bb1f0740be8355e1be6cc24edf09547d984
tools: libxl: do not leak diskpath during local disk attach

libxl__device_disk_local_initiate_attach is assigning dls->diskpath with a
strdup of the device path. This is then passed to the callback, e.g.
parse_bootloader_result but bootloader_cleanup will not free it.

Since the callback is within the scope of the (e)gc and therefore doesn't need
to be malloc'd, a gc'd alloc will do. All other assignments to this field use
the gc.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=767295

Reported-by: Gedalya <gedalya@gedalya.net>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl.c